# $Id$
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=totem
pkgver=3.24.0
pkgrel=1
pkgdesc="Movie player for the GNOME desktop based on GStreamer"
url="https://wiki.gnome.org/Apps/Videos"
arch=(i686 x86_64)
license=(GPL2 custom)
depends=(totem-plparser iso-codes libpeas clutter-gtk clutter-gst grilo gsettings-desktop-schemas
         dconf python-gobject python-xdg gnome-desktop gst-plugins-base gst-plugins-good
         gst-plugins-bad)
makedepends=(intltool libnautilus-extension lirc vala itstool docbook-xsl python-pylint
             gobject-introspection git gnome-common appstream-glib gtk-doc)
optdepends=('gst-plugins-ugly: Extra media codecs'
            'gst-libav: Extra media codecs'
            'lirc-utils: Infrared Remote Control plugin'
            'grilo-plugins: Media discovery'
            'python-dbus: MPRIS plugin')
groups=(gnome)
options=('!emptydirs')
conflicts=(totem-plugin)
replaces=(totem-plugin)
_commit=dec87510f22daf87144eda36e1d97bfcabace1d1  # tags/V_3_24_0^0
source=("git+https://git.gnome.org/browse/totem#commit=$_commit"
        "git+https://git.gnome.org/browse/libgd")
sha256sums=('SKIP'
            'SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^V_//;s/_/./g;s/-/+/g'
}

prepare() {
  cd $pkgname

  git submodule init
  git config --local submodule.libgd.url "$srcdir/libgd"
  git submodule update

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr \
    --sysconfdir=/etc \
    --libexecdir=/usr/lib/totem \
    --localstatedir=/var \
    --disable-static \
    --enable-python \
    --enable-nautilus \
    --enable-gtk-doc

  # https://bugzilla.gnome.org/show_bug.cgi?id=655517
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/totem/COPYING"
}
